﻿@model UserEditModel
@{
    if (Model == null || Model.Id == 0)
    {
        ViewBag.Title = "添加用户";
    }
    else
    {
        ViewBag.Title = "修改用户";
    }
}
@section BodyNav
{
    > @Html.ActionLink("用户列表", "List", "User") > 编辑用户
}
@using (Html.BeginForm())
{
    <table class="window">
        <tr class="head">
            <th colspan="2">
                编辑用户
            </th>
        </tr>
        <tr>
            <th width="100">
                @Html.LabelFor(m => m.RealName)
            </th>
            <td>@Html.EditorFor(m => m.RealName)
                @Html.ValidationMessageFor(m => m.RealName)
            </td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(m => m.UserName)
            </th>
            <td>
                @if (Model == null || Model.Id == 0)
                {
                    @Html.EditorFor(m => m.UserName)@Html.ValidationMessageFor(m => m.UserName)
                }
                else
                {
                    @Model.UserName
                    @Html.HiddenFor(m => m.UserName)
                }
            </td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.UserType)
            </th>
            <td>@Html.DropDownListFor(m => m.UserType, ViewBag.UserTypes as IList<SelectListItem>, "请选择", null)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                @if (Model != null && Model.Id > 0)
                {
                    @Html.HiddenFor(m => m.Id)
                }
                <input type="submit" value="保存" class="btnBtn" />
            </td>
        </tr>
    </table>
}